<template>
  <div class="dashboard-container">
    <div class="dashboard-text">
      <el-upload action="#" :http-request="httpRequest">
        <el-button>上传</el-button>
      </el-upload>
    </div>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: 'Dashboard',
  methods: {
    httpRequest({ file }) {
      const fd = new FormData()
      fd.append('photo', file)
      axios({
        url: 'http://toutiao.itheima.net/v1_0/user/photo',
        headers: {
          Authorization: `Bearer 30ca21fe-a33e-47fc-840a-5a880af29a76`
        },
        method: 'patch',
        data: fd
      }).then((res) => {
        console.log(res)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
